package core;

import view.GUI.LabelReader;

/**
 * Singleton class for tracking messages between ports (call or get)
 * 
 * @author Wijnand
 */
public class Tracker {

	private static Tracker instance = new Tracker();
	
	public Tracker() {}

	public static Tracker getInstance() { return instance; }

	public static void setInstance(Tracker tracker)
	{
		instance = tracker;
	}

	

	public void valueRequested(ValuePort port)
	{
		java.lang.System.out.println("Port " + port + ": " + LabelReader.getInstance().getString("requestedValue"));
	}

	public void valueDispatched(OutPort source, Object value)
	{
		java.lang.System.out.println("OutPort " + source + ": " + LabelReader.getInstance().getString("dispatched")+" " + value);
	}

	public void valueReceived(InPort target, Object value)
	{
		java.lang.System.out.println("InPort " + target + ": " + LabelReader.getInstance().getString("received")+ " " + value);
	}

	public void startDispatch(DispatcherPort dispatcher, TriggerPort target)
	{
		java.lang.System.out.println("DispatcherPort " + dispatcher + ": " + LabelReader.getInstance().getString("dispatchingStarted"));
	}

	public void stopDispatch(DispatcherPort dispatcher)
	{
		java.lang.System.out.println("DispatcherPort " + dispatcher + ": " + LabelReader.getInstance().getString("dispatchingStopped"));
	}

	public void startCall(TriggerPort triggerPort)
	{
		java.lang.System.out.println("TriggerPort " + triggerPort + ": " + LabelReader.getInstance().getString("callStarted"));
	}

	public void stopCall(TriggerPort triggerPort)
	{
		java.lang.System.out.println("TriggerPort " + triggerPort + ": " + LabelReader.getInstance().getString("callStopped"));
	}
}
